package fr.lelouet.ServersModel.virtual;

import java.util.Map;
import java.util.Set;

import fr.lelouet.ServersModel.physical.DataCenter;

/**
 * a plan to allocate {@link VirtualMachine}, with a specific state, on
 * {@link VirtualServer}<br />
 * there are3 states for virtual machines : running, suspended on RAM or on disk
 * @author Le Louet
 */
public interface Allocation extends Cloneable {

  public enum VmStates {
    Running, STR, STD;
  };

  /** @return the {@link DataCenter} this allocates vms in */
  public DataCenter getDataCenter();

  /** @return a map of the allocation of running machines */
  public Map<VirtualMachine, VirtualServer> getVMsPositions();

  /** @return a unmodifiable map of the states of running machines */
  public Map<VirtualMachine, VmStates> getVMsStates();

  /**
   * @return a set of {@link VirtualMachine} that are running on a specific
   *         server
   */
  public Set<VirtualMachine> getRunningMachines(VirtualServer server);

  /**
   * @return a set of {@link VirtualMachine} that are suspended to ram on a
   *         specific server
   */
  public Set<VirtualMachine> getSTRMachines(VirtualServer server);

  /**
   * @return a set of {@link VirtualMachine} that are suspended to disk on a
   *         specific server
   */
  public Set<VirtualMachine> getSTDMachines(VirtualServer server);

}
